/**
 * 现场管理
 */
package com.kerrykidz.filemanagement.controller;

import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.kerrykidz.common.Constants;
import com.kerrykidz.common.PrimaryKeyGenerator;
import com.kerrykidz.common.PrimaryKeyGenerator.BusinessType;
import com.kerrykidz.common.service.ICommonService;
import com.kerrykidz.dao.model.LocPerInoutEntity;
import com.kerrykidz.filemanagement.service.ISalesService;
import com.kerrykidz.filemanagement.service.ISiteService;
import com.kerrykidz.filemanagement.service.IVipService;
import com.kerrykidz.membership.dao.model.CusGuaEntity;
import com.kerrykidz.membership.dao.model.CusMemEntity;
import com.kerrykidz.membership.dao.model.GblCusCReltypeEntity;
import com.kerrykidz.membership.service.IGuaService;
import com.kerrykidz.membership.service.IMemberService;
import com.kerrykidz.membership.service.ISingleService;
import com.kerrykidz.parreserve.dao.model.ParReserveEntity;
import com.kerrykidz.parreserve.service.IParReserveService;
import com.kerrykidz.sales.service.IOrderService;
import com.kerrykidz.sales.service.IPaymentService;
import com.kerrykidz.scminvoicing.dao.model.GblScmPrdEntity;
import com.kerrykidz.scminvoicing.service.IScmInvocingProductInfoService;
import com.kerrykidz.system.dao.model.GblCusCCountryEntity;
import com.kerrykidz.system.dao.model.SecUsrEntity;
import com.kerrykidz.system.service.ICusMemService;
import com.kerrykidz.system.service.IGblService;
import com.kerrykidz.system.service.IUserService;
import com.kerrykidz.system.util.UserUtil;
import com.kerrykidz.system.vo.UserInfo;
import com.rdp.framework.core.model.MyBatisSuperModel;
import com.rdp.framework.exception.RDPException;
import com.rdp.util.GenerationUUID;

/**
 * @author YJJ
 * 
 */
@RequestMapping("management/site")
@Controller
public class SiteController {

	@Autowired
	private ICommonService commonService;
	@Autowired
	private ISingleService singleService;
	@Autowired
	private IMemberService memberService;
	@Autowired
	private IGuaService guaService;
	@Autowired
	private IScmInvocingProductInfoService productService;
	@Autowired
	private IOrderService orderService;
	@Autowired
	private IPaymentService paymentService;
	@Autowired
	private IVipService vipService;
	@Autowired
	private ISalesService salesService;
	@Autowired
	private IGblService gblService;
	@Autowired
	private ISiteService siteService;
	@Autowired
	IParReserveService parReserveService;
	@Autowired
	private ICusMemService cusMemService;
	@Autowired
	private IUserService userService;

	/**
	 * 跳转到购买单次票界面
	 * @return
	 * @throws RDPException
	 */
	@RequestMapping("/locPerManager")
	public ModelAndView locPerManager(@RequestParam(value = "type", required = false) String type) throws RDPException {
		ModelAndView mv = new ModelAndView("management/management_ape");
		mv.addObject("type", type);
		return mv;
	}

	/**
	 * 跳转到访客界面
	 * 
	 * @return
	 * @throws RDPException 
	 */
	@RequestMapping("/jumpVisitor")
	public ModelAndView jumpVisitor() throws RDPException {

		ModelAndView mv = new ModelAndView("membership/membership_visitor_detail");
		
		List<GblCusCReltypeEntity> reltypeList = memberService.findReltypes();
		mv.addObject("reltypeList", reltypeList);

		// 销售列表
		List<SecUsrEntity> salesList = salesService.listSales();
		mv.addObject("salesList", salesList);

		// 国籍列表
		List<GblCusCCountryEntity> countryList = gblService.selectAll();
		mv.addObject("countryList", countryList);
		return mv;
	}


	/**
	 * 保存会员
	 * 
	 * @return
	 * @throws RDPException
	 */
	@RequestMapping("/saveMember")
	@ResponseBody
	public Map<String, String> saveMember(HttpSession session, CusMemEntity member) throws RDPException {
		Map<String, String> map = new HashMap<String, String>();
		UserInfo user = UserUtil.getUserFromSession();
		member.setFkBranId(user.getBranId());
		member.setModiBy(user.getUserId());
		if (StringUtils.isBlank(member.getPkMemId())) {
			if (memberService.checkFingerprintExist(member.getFing1()) != 0 || memberService.checkFingerprintExist(member.getFing2()) != 0) {
				map.put("result", Constants.FAILURE);
				map.put("message", "指纹已存在于其它用户，不可重复创建！");
				return map;
			}
			member.setStatus(Constants.MEMBER_STATUS_NOTACTIVE);
			if (StringUtils.isBlank(member.getFamilyId())) {
				String familyId = GenerationUUID.getGenerationUUID();
				member.setFamilyId(familyId);
				map.put("familyId", familyId);
			}
			vipService.createVip(member);
			map.put("memberId", member.getPkMemId());
		} else {
			vipService.updateVip(member);
			map.put("memberId", member.getPkMemId());
		}
		map.put("result", Constants.SUCCESS);
		return map;
	}

	/**
	 * 验证采集的指纹是否已存在于其它用户
	 * 
	 * @param fingerprint
	 *                指纹数据
	 * @return SUCCESS：不存在 FAILURE：已存在
	 * @throws RDPException
	 * @throws UnsupportedEncodingException
	 * @date: 2014年8月22日
	 */
	@RequestMapping("/checkFingerprintExist")
	@ResponseBody
	public String checkFingerprintExist(String fingerprint) throws RDPException, UnsupportedEncodingException {

		if (fingerprint == null) return Constants.SUCCESS;
		if (memberService.checkFingerprintExist(fingerprint) != 0) {
			return Constants.FAILURE;
		}
		return Constants.SUCCESS;
	}

	/**
	 * 保存监护人
	 * 
	 * @return
	 * @throws RDPException
	 */
	@RequestMapping("/saveGua")
	@ResponseBody
	public Map<String, String> saveGua(HttpSession session, CusGuaEntity gua) throws RDPException {
		Map<String, String> map = new HashMap<String, String>();
		UserInfo user = UserUtil.getUserFromSession();
		gua.setFkBranId(user.getBranId());
		gua.setModiBy(user.getUserId());
		if (StringUtils.isBlank(gua.getPkGuaId())) {
			if (memberService.checkFingerprintExist(gua.getFing1()) != 0 || memberService.checkFingerprintExist(gua.getFing2()) != 0) {
				map.put("result", Constants.FAILURE);
				map.put("message", "指纹已存在于其它用户，不可重复创建！");
				return map;
			}
			vipService.createGuardian(gua);
		} else {
			vipService.updateGuardian(gua);
		}
		map.put("result", Constants.SUCCESS);
		return map;
	}

	/**
	 * 删除会员
	 * 
	 * @return
	 * @throws RDPException
	 */
	@RequestMapping("/deleteMember")
	@ResponseBody
	public String deleteMember(HttpSession session, String memberId) throws RDPException {
		CusMemEntity member = new CusMemEntity();
		member.setPkMemId(memberId);
		UserInfo user = UserUtil.getUserFromSession();
		member.setModiBy(user.getUserId());
		memberService.deleteMember(member);
		return Constants.SUCCESS;
	}

	/**
	 * 删除监护人
	 * 
	 * @return
	 * @throws RDPException
	 */
	@RequestMapping("/deleteGua")
	@ResponseBody
	public String deleteGua(HttpSession session, String guaId) throws RDPException {
		CusGuaEntity gua = new CusGuaEntity();
		gua.setPkGuaId(guaId);
		UserInfo user = UserUtil.getUserFromSession();
		gua.setModiBy(user.getUserId());
		guaService.deleteGua(gua);
		return Constants.SUCCESS;
	}

	/**
	 * 根据姓名或电话号码查询会员
	 * 
	 * @return
	 * @throws RDPException
	 * @throws UnsupportedEncodingException
	 */
	@RequestMapping("/queryMember")
	@ResponseBody
	public List<CusMemEntity> queryMember(
					@RequestParam(value = "nameOrTel") String nameOrTel,
					@RequestParam(value = "cpnId", required = false) String cpnId)
					throws RDPException,
					UnsupportedEncodingException {
		nameOrTel = URLDecoder.decode(nameOrTel, "UTF-8");
		List<CusMemEntity> list = memberService.findSiteMemberByNameOrTel(nameOrTel, UserUtil.getUserFromSession().getBranId());
		
		//把所有访客以销售人员显示
		Map<String, SecUsrEntity> map = new HashMap<String, SecUsrEntity>() ;
		if(null!=list){
			for (int i = (list.size()-1); i >= 0; i --) {//从后往前跑
				CusMemEntity cusMem=list.get(i);
				String memType=cusMem.getMemType();
				if(null!=memType && "3".equals(memType)){
					//如果是访客，就查出此方可对于的销售员，而后移除此访客
					SecUsrEntity secUsr=cusMemService.findSaleUserById(cusMem.getPkMemId());
					if(null!=secUsr){
						map.put(secUsr.getUsrName(), secUsr) ;
					}
					list.remove(i);
				}
			}
		}
		
		//移除所有新建的
		if(null!=list){
			for (int i = (list.size()-1); i >= 0; i --) {//从后往前跑
				CusMemEntity mem = list.get(i);
				if ("5".equals(mem.getStatus())) {
					list.remove(i);
				}
			}
		}
		
		if(null!=map){
			Set keyset = map.keySet();  
			for(Object key : keyset){  
				CusMemEntity cusMem=new CusMemEntity();
				cusMem.setMemType("4");//临时存储，代表销售
				cusMem.setMemName(key.toString());//临时存储销售人
				SecUsrEntity secUsr=map.get(key);
				if(secUsr!=null){
					cusMem.setPkMemId(secUsr.getPkUsrId());
					cusMem.setImagePath(secUsr.getImagePath());
				}
				list.add(cusMem);
			}
		}
		return list;

	}

	/**
	 * 根据指纹查询会员
	 * 
	 * @return
	 * @throws RDPException
	 * @throws UnsupportedEncodingException
	 */
	@RequestMapping("/queryMemberByFingerprint")
	@ResponseBody
	public CusMemEntity queryMemberByFingerprint(@RequestParam(value = "fingerprint") String fingerprint) throws RDPException {
		Object obj = memberService.findFingerprint(fingerprint);
		if (obj instanceof CusMemEntity) {
			CusMemEntity mem = (CusMemEntity) obj;
			String memType=mem.getMemType();
			if(null!=memType && "3".equals(memType)){
				//如果是访客，就查出此方可对于的销售员，而后移除此访客
				SecUsrEntity secUsr=cusMemService.findSaleUserById(mem.getPkMemId());
				mem.setMemType("4");//临时存储，代表销售
				mem.setMemName(secUsr.getUsrName());//临时存储销售人
				mem.setPkMemId(secUsr.getPkUsrId());
				mem.setImagePath(secUsr.getImagePath());
			}
			
			//所有新建的
			String status=mem.getStatus();
			if(null!=status && !"3".equals(memType)){
				if ("5".equals(status)) {
					mem=null;
				}
			}
			return mem;
		}
		return null;
	}
	
	/**
	 * 根据指纹查询会员(销售)
	 * 
	 * @return
	 * @throws RDPException
	 * @throws UnsupportedEncodingException
	 */
	@RequestMapping("/queryMemberByFingerprintAndSale")
	@ResponseBody
	public CusMemEntity queryMemberByFingerprintAndSale(@RequestParam(value = "fingerprint") String fingerprint) throws RDPException {
		Object obj = memberService.findFingerprint(fingerprint);
		if (obj instanceof CusMemEntity) {
			CusMemEntity mem = (CusMemEntity) obj;
			String memType=mem.getMemType();
			if(null!=memType && "3".equals(memType)){
				return mem;
			}
		}
		return null;
	}

	/**
	 * 根据会员编号查询会员
	 * 
	 * @return
	 * @throws RDPException
	 * @throws UnsupportedEncodingException
	 */
	@RequestMapping("/queryMemberById")
	@ResponseBody
	public CusMemEntity queryMemberById(@RequestParam(value = "memberId") String memberId) throws RDPException {
		CusMemEntity member = memberService.findMemberById(memberId);
		return member;

	}

	/**
	 * 根据监护人编号查询监护人
	 * 
	 * @return
	 * @throws RDPException
	 * @throws UnsupportedEncodingException
	 */
	@RequestMapping("/queryGuaById")
	@ResponseBody
	public CusGuaEntity queryGuaById(@RequestParam(value = "guaId") String guaId) throws RDPException {
		CusGuaEntity gua = guaService.findGuaById(guaId);
		return gua;

	}

	/**
	 * 查询会员及其关联信息
	 * 
	 * @param memberId
	 *                会员编号
	 * @param cpnId
	 *                玩伴券编号
	 * @param cpnAmount
	 *                玩伴券优惠额度
	 * @return
	 * @throws RDPException
	 */
	@RequestMapping("/queryMemberDetail")
	public ModelAndView queryMemberDetail(HttpSession session, @RequestParam(value = "memberId", required = false) String memberId, @RequestParam(value = "type", required = false) String type, @RequestParam(value = "inTime", required = false) String inTime, @RequestParam(value = "outTime", required = false) String outTime) throws RDPException {

		ModelAndView mv = new ModelAndView("management/management_visitor");
		if (StringUtils.isNotBlank(memberId)) {
			// 会员、非会员信息 兄弟姐妹
			List<CusMemEntity> memList = memberService.findSiteMemberAndSiblingsById(memberId);
			if (null!=memList && memList.size() > 0) {
				//第一条为默认值
				mv.addObject("memberInfo", memList.get(0));
				
				for (int i = 0; i < memList.size(); i++) {
					CusMemEntity cusMem=memList.get(i);
					if(null!=cusMem){
						//查询会员下成人票数量
						if(null!=cusMem.getFkOrderId()){
							Integer guaTicketCount=vipService.getTicketCountContainone(cusMem.getFkOrderId());//该会员下成人票数量
							if(null!=guaTicketCount){
								cusMem.setGuaTicketCount(guaTicketCount);
							}
						}
						
						//查询会员是否还有未使用的单次票
						boolean isSingleTicket=memberService.checkEnableSingleByMemberId(cusMem.getPkMemId());
						cusMem.setIsSingleTicket(isSingleTicket);
					}
				}
			}
			mv.addObject("memList", memList);
			mv.addObject("memberId", memberId);
			mv.addObject("type", type);
			//判断会员进出场背景色
			mv.addObject("inTime", inTime);
			mv.addObject("outTime", outTime);
			
			// 监护人列表
			List<CusGuaEntity> guaList = memberService.findSiteGuaByMemberId(memberId);
			mv.addObject("guaList", guaList);
		}

		List<GblCusCReltypeEntity> reltypeList = memberService.findReltypes();
		mv.addObject("reltypeList", reltypeList);

		// 单次票商品列表
		UserInfo user = UserUtil.getUserFromSession();
		GblScmPrdEntity prd = new GblScmPrdEntity();
		prd.setResverseType(Constants.PRODUCT_TYPE_SINGLE);
		prd.setFkBranId(user.getBranId());
		List<GblScmPrdEntity> productList = productService.getProductInfo(prd);
		mv.addObject("productList", productList);

		// 销售列表
		List<SecUsrEntity> salesList = salesService.listSales();
		mv.addObject("salesList", salesList);

		// 国籍列表
		List<GblCusCCountryEntity> countryList = gblService.selectAll();
		mv.addObject("countryList", countryList);

		return mv;
	}
	
	/**
	 * 查询销售带领访客入场
	 * 
	 * @param userId 销售编号
	 * @return
	 * @throws RDPException
	 * @throws UnsupportedEncodingException 
	 */
	@RequestMapping("/querySaleDetail")
	public ModelAndView querySaleDetail(HttpSession session, @RequestParam(value = "userId", required = false) String userId, @RequestParam(value = "type", required = false) String type, @RequestParam(value = "nameOrTel", required = false) String nameOrTel) throws RDPException, UnsupportedEncodingException {
		ModelAndView mv = new ModelAndView("management/management_sticket");
		if (StringUtils.isNotBlank(userId)) {
			//根据销售查询旗下的访客
			if(!StringUtils.isBlank(nameOrTel)){
				nameOrTel = URLDecoder.decode(nameOrTel, "UTF-8");
			}
			List<CusMemEntity> memList = memberService.findMemberByNameOrTelAndSale(nameOrTel, userId, UserUtil.getUserFromSession().getBranId());
			mv.addObject("memList", memList);
			
			mv.addObject("type", type);
			
			//记录哪个销售
			SecUsrEntity secUsr=userService.findEntityById(userId);
			if(secUsr!=null){
				mv.addObject("secUsr", secUsr);
			}
		}
		return mv;
	}
	
	/**
	 * 查询销售带领访客入场
	 * 
	 * @param userId 销售编号
	 * @return
	 * @throws RDPException
	 * @throws UnsupportedEncodingException 
	 */
	@RequestMapping("/querySaleDetailAndSale")
	@ResponseBody
	public List<CusMemEntity> querySaleDetailAndSale(@RequestParam(value = "userId", required = false) String userId, @RequestParam(value = "type", required = false) String type, @RequestParam(value = "nameOrTel", required = false) String nameOrTel) throws RDPException, UnsupportedEncodingException {
		if (StringUtils.isNotBlank(userId)) {
			//根据销售查询旗下的访客
			if(!StringUtils.isBlank(nameOrTel)){
				nameOrTel = URLDecoder.decode(nameOrTel, "UTF-8");
			}
			List<CusMemEntity> memList = memberService.findMemberByNameOrTelAndSale(nameOrTel, userId, UserUtil.getUserFromSession().getBranId());
			return memList;
		}
		return null;
	}
	
	/**
	 * 跳转到场内人员查询
	 * @return
	 * @throws RDPException
	 */
	@RequestMapping("/locPerMemer")
	public ModelAndView locPerMemer() throws RDPException {
		ModelAndView mv = new ModelAndView("management/management");
		return mv;
	}
	
	/**
	 * 场内人员查询（分页）
	 * 
	 * @param condition
	 * @param inTime
	 * @param outTime
	 * @return
	 * @throws RDPException
	 */
	@RequestMapping("/listPerMemer")
	@ResponseBody
	public MyBatisSuperModel listPerMemer(
			@RequestParam(value = "condition", required = false) String condition,
			@RequestParam(value = "inTimeStart", required = false) String inTimeStart,
			@RequestParam(value = "inTimeEnd", required = false) String inTimeEnd,
			@RequestParam(value = "typeArray", required = false) String[] typeArray,
			MyBatisSuperModel model) throws RDPException {
		Map<String, Object> paramMap = new HashMap<String, Object>();
		paramMap.put(Constants.PER_INTIME_START, inTimeStart);
		paramMap.put(Constants.PER_INTIME_END, inTimeEnd);
		StringBuffer types=new StringBuffer("");
//		List<String> typeList = new ArrayList<String>();
		if(null!=typeArray){
			for (int i = 0; i < typeArray.length; i++) {
				String type=typeArray[i];
				if(i==0){
					types.append(type);
				}else{
					types.append(","+type);
				}
			}
			paramMap.put(Constants.PER_TYPES, types.toString());
		}
		List<LocPerInoutEntity> list = null;
		// 判断那种类型
		if (null!=condition && !"".equals(condition) && StringUtils.isNumeric(condition) == true) {
			// 号码查询
			paramMap.put(Constants.PER_TELNUM, condition);
		} else if (null!=condition && !"".equals(condition) && (condition.indexOf("@") != -1 || condition.indexOf(".") != -1)) {
			// 邮箱查询
			paramMap.put(Constants.PER_EMAIL, condition);
		} else {
			// 姓名查询
			paramMap.put(Constants.PER_CONDITION, condition);
		}
		model.setParams(paramMap);
		list = siteService.getAllPerInOut(model);
		if(null!=list && list.size()>0){
			for (int i = 0; i < list.size(); i++) {
				//加入监护人集合
				LocPerInoutEntity locPerInout=list.get(i);
				if(null!=locPerInout && null!=locPerInout.getPkMemId()){
					List<CusGuaEntity> guaList = siteService.getCusGuaList(locPerInout.getFamBatch());
					locPerInout.setGuaList(guaList);
				}
			}
		}
		model.setResults(list);
		return model;
	}
	
	/**
	 * 场内派对/团体查询（分页）
	 * 
	 * @param condition
	 * @param inTime
	 * @param outTime
	 * @return
	 * @throws RDPException
	 */
	@RequestMapping("/listPartyMemer")
	@ResponseBody
	public MyBatisSuperModel listPartyMemer(
			@RequestParam(value = "condition", required = false) String condition,
			@RequestParam(value = "inTimeStart", required = false) String inTimeStart,
			@RequestParam(value = "inTimeEnd", required = false) String inTimeEnd,
			@RequestParam(value = "flagArray", required = false) String[] flagArray,
			MyBatisSuperModel model) throws RDPException {
		Map<String, Object> paramMap = new HashMap<String, Object>();
		paramMap.put(Constants.PER_INTIME_START, inTimeStart);
		paramMap.put(Constants.PER_INTIME_END, inTimeEnd);
		StringBuffer flags=new StringBuffer("");
		if(null!=flagArray){
			for (int i = 0; i < flagArray.length; i++) {
				String flag=flagArray[i];
				if(i==0){
					flags.append(flag);
				}else{
					flags.append(","+flag);
				}
			}
			paramMap.put(Constants.PER_FLAGS, flags.toString());
		}
		List<ParReserveEntity> list = null;
		// 判断那种类型
		if (null!=condition && !"".equals(condition) && StringUtils.isNumeric(condition) == true) {
			// 号码查询
			paramMap.put(Constants.PER_TELNUM, condition);
		} else if (null!=condition && !"".equals(condition) && (condition.indexOf("@") != -1 || condition.indexOf(".") != -1)) {
			// 邮箱查询
			paramMap.put(Constants.PER_EMAIL, condition);
		} else {
			// 姓名查询
			paramMap.put(Constants.PER_CONDITION, condition);
		}
		model.setParams(paramMap);
		list = parReserveService.getAllPartyInOut(model);
		if(null!=list && list.size()==1 && list.get(0).getPkParresId()==null){
			list=null;
		}
		model.setResults(list);
		return model;
	}
	
	/**
	 * 进场
	 * YJJ
	 * @return
	 */
	@RequestMapping("/locPerGoIn")
	@ResponseBody
	public String locPerGoIn(HttpServletRequest request, HttpSession session, @RequestParam(value = "inMemberIds", required = false) String inMemberIds, @RequestParam(value = "inGuaIds", required = false) String inGuaIds, @RequestParam(value = "receivePwds", required = false) String receivePwds, @RequestParam(value = "type", required = false) String type, @RequestParam(value = "saleId", required = false) String saleId, @RequestParam(value = "familyId", required = false) String familyId) throws NumberFormatException, Exception {
		UserInfo user = UserUtil.getUserFromSession();
		String userId = user.getUserId();
		String branId = user.getBranId();
		String abbrCode = user.getAbbrCode();
		String batPath="";
		try {
			//批次进场号，不是家庭号
			familyId = PrimaryKeyGenerator.getPrimaryKey(BusinessType.PC, abbrCode);
			batPath = siteService.insertLocPerInOut(request, inMemberIds, inGuaIds, receivePwds, type, saleId, userId, branId, abbrCode, familyId);
		} catch (Exception e) {
			return "";
		}
		return batPath;
	}
	
	/**
	 * 出场
	 * YJJ
	 * @return
	 */
	@RequestMapping("/locPerGoOut")
	@ResponseBody
	public String locPerGoOut(HttpServletRequest request, HttpSession session, @RequestParam(value = "inMemberIds", required = false) String inMemberIds, @RequestParam(value = "inGuaIds", required = false) String inGuaIds) throws NumberFormatException, Exception {
		String batPath="";
		try {
			batPath = siteService.updateLocPerInOut(request, inMemberIds, inGuaIds);
		} catch (Exception e) {
			return "";
		}
		return batPath;
	}
	
	/**
	 * 判断访客是否已体验
	 * YJJ
	 * @return
	 */
	@RequestMapping("/getVisitorIn")
	@ResponseBody
	public String getVisitorIn(@RequestParam(value = "memberId", required = false) String memberId) throws Exception {
		try {
			List<LocPerInoutEntity> visitorInList = siteService.getLocPerInOutByMemId(memberId);
			if(null!=visitorInList && visitorInList.size()>0){
				return Constants.SUCCESS;
			}
		} catch (Exception e) {
			return Constants.FAILURE;
		}
		return null;
	}
}
